<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="content-Type" charset="UTF-8">
    <meta http-equiv="x-ua-compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Title</title>
</head>
<body>

<p>删除书籍成功， <span id="s1">3</span>秒钟之后跳转回书籍列表页面！</p>

</body>
<script>
    // 每隔一秒钟就修改s1的text
    var currentNum = document.getElementById('s1').innerText;
    // setInterval(需要做的事情也就是代码段或者是函数，间隔时间)
    // 这样一个对象生成之后需要做一个赋值操作，建立引用和实例之间的联系
    var t2 = setInterval(function () {
        currentNum = document.getElementById('s1').innerText;
        document.getElementById('s1').innerText = currentNum - 1;
        if (currentNum == 1) {
            clearInterval(t2);
            location.href = '/book_list/';
        }
    }, 1000);
</script>
</html>